﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;

/// <summary>
/// UI模型管理
/// </summary>
public class UIModelMgr : Singleton<UIModelMgr>
{
    List<UIModel> _allUIModel = new List<UIModel>();
    int _putModelPosY = 100;
    const int deltaY = 30;

    public UIModel CreateUIModel(int width, int height, RawImage modelImage, GameObject model)
    {
        var ui = new UIModel(width, height, modelImage, model);

        ui.SetRootPosition(new Vector3(-10, _putModelPosY, -10)); // 放在一个看不见的地方
        _putModelPosY += deltaY;

        _allUIModel.Add(ui);

        return ui;
    }

    public void RemoveUIModel(UIModel ui)
    {
        ui.Release();
        _allUIModel.Remove(ui);
    }
}
